# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=donpapi
_pkgname=DonPAPI
pkgver=V1.2.0.r40.g61db37a
pkgrel=3
epoch=1
pkgdesc='Dumping revelant information on compromised targets without AV detection with DPAPI.'
arch=('any')
groups=('blackarch' 'blackarch-windows' 'blackarch-exploitation')
url='https://github.com/login-securite/DonPAPI'
license=('custom:unknown')
depends=('python' 'exrex' 'impacket-ba' 'python-dploot' 'python-rich'
         'python-sqlalchemy' 'python-termcolor' 'python-jinja' 'python-flask'
         'python-marshmallow-sqlalchemy' 'python-flask-rich'
         'python-flask-basicauth' 'python-flask-cors' 'python-pyjwt')
makedepends=('git' 'python-build' 'python-pip')
source=("git+https://github.com/login-securite/DonPAPI.git")
sha512sums=('SKIP')

pkgver() {
  cd $_pkgname

  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd $_pkgname

  python -m build --wheel --outdir="$startdir/dist"
}

package() {
  cd $_pkgname

  pip install \
    --verbose \
    --disable-pip-version-check \
    --no-warn-script-location \
    --ignore-installed \
    --no-compile \
    --no-deps \
    --root="$pkgdir" \
    --prefix=/usr \
    --no-index \
    --find-links="file://$startdir/dist" \
    "$pkgname"

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/$pkgname"
}

